package com.leyantech.ecp.agenx.task.consumer;

import com.leyantech.ecp.agenx.common.sender.Dispatcher;
import com.leyantech.ecp.agenx.task.converter.output.TaskMessageConverter;
import com.leyantech.ecp.agenx.task.filter.TaskFilter;

import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import io.vertx.core.json.JsonObject;
import lombok.extern.slf4j.Slf4j;

/**
 * @author eahau, {@literal <eahau@foxmail.com>}
 * @date 2022-11-01.
 */
@Slf4j
@Singleton
public class TaskMessageConsumer extends TaskConsumer<JsonObject> {

  @Inject
  public TaskMessageConsumer(
      Dispatcher dispatcher,
      TaskMessageConverter<JsonObject> taskMessageConverter,
      ImmutableList<TaskFilter<JsonObject>> filters) {
    super(dispatcher, taskMessageConverter, filters);
  }

  @Override
  protected String getStoreId(JsonObject jsonObject) {
    return jsonObject.getString("sid");
  }

  @Override
  protected String getAssistantId(JsonObject jsonObject) {
    return jsonObject.getString("aid");
  }

}
